{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "# Percentiles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAERNJREFUeJzt3W2MXNddx/Hvr24bUKlITLauYzs4SKbgSPRBq1D6pLaB\nJjRVHV4QuRJgwJJVKYUiIRWHSiAhWXJBqiiCgKy24KoPxiqEWG3a4hiiihdt6rRJGycxcRtHseXY\n2/QZJBeHPy/2pkwc7+4d78zO7vH3I43m3HPv3fvfE+c3Z+/cuZOqQpLUrudNugBJ0ngZ9JLUOINe\nkhpn0EtS4wx6SWqcQS9JjTPoJalxBr0kNc6gl6TGPX/SBQBceeWVtXHjxkmXIUkryn333ffNqppa\naLtlEfQbN27k8OHDky5DklaUJI/32c5TN5LUOINekhpn0EtS4wx6SWqcQS9JjTPoJalxBr0kNc6g\nl6TGGfSS1Lhl8clYaSXauPPTF+w/vvumJa5Emp8zeklqnDN6acSc6Wu5cUYvSY3rFfRJLk/yySSP\nJHk4yS8lWZ3kYJJHu+crBra/LcmxJEeT3DC+8iVJC+k7o/8A8Nmq+jng5cDDwE7gUFVtAg51yyTZ\nDGwFrgVuBG5PsmrUhUuS+lkw6JP8JPAG4EMAVfXDqvoOsAXY2222F7i5a28B9lXV2ap6DDgGXDfq\nwiVJ/fSZ0V8DzAB/n+QrST6Y5EXAmqo61W3zJLCma68DnhjY/0TXJ0magD5B/3zgVcDfVtUrgf+i\nO03zjKoqoIY5cJIdSQ4nOTwzMzPMrpKkIfS5vPIEcKKqvtgtf5LZoD+dZG1VnUqyFjjTrT8JbBjY\nf33X9yxVtQfYAzA9PT3Ui4S0lOa6XFJaKRYM+qp6MskTSV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/23nsQ49hkX4K3AZ4AArwa+uMzqeyPwqUn82xuo4Q3Aq4AH51g/sTEcosaJ\nj+OwjxUxo6+qf62qc93iF5i9Lv98P7rtQlX9EHjmtgtLVePDVTXMh76WXM8aJzqO3bH2du29wM1L\neOz59BmXLcBHatYXgMuTrF1G9U1cVX0e+NY8m0xyDIFeNa44KyLoz/O7zL7in+9Ct11YtyQVDaeA\nu5Pc1306eLmZ9DiuqapTXftJYM0c2y31OPYZl0mOXd9jv6Y7JfKZJNcuTWlDmfS/v76W+zg+y7K5\nH32Su4GXXmDVe6vqzm6b9wLngI8tZW3P6FNjD6+rqpNJXgIcTPJIN4NYTjWO1Xw1Di5UVSWZ67Kw\nsY5jo74MXF1VP0jyVuBfgE0TrmklWnHjuGyCvqp+eb71SX4beBtwfXUnys6z4G0XFmuhGnv+jJPd\n85kkdzD7J/fIAmoENU50HJOcTrK2qk51f7KfmeNnjHUcL6DPuIx97ObR57Yj3xto35Xk9iRXVtVy\nur/MJMewlxUyjs+yIk7ddF9i8h7g7VX133Nstuxvu5DkRUle/Eyb2TeZL/jO/gRNehwPANu69jbg\nOX+FTGgc+4zLAeC3uitHXg18d+A01LgtWF+SlyZJ176O2f//n1qi+vqa5Bj2skLG8dkm/W5wnwdw\njNnzdvd3j7/r+q8C7hrY7q3AfzJ79cF7l7jGX2P2fOJZ4DTwufNrZPaKiAe6x5HlWOMyGMefAg4B\njwJ3A6uXyzheaFyAdwLv7Nph9gt3vg58jXmuvppQfe/qxusBZi9qeM1S1tfV8AngFPA/3b/F7ctp\nDHvWOPFxHPbhJ2MlqXEr4tSNJOniGfSS1DiDXpIaZ9BLUuMMeklqnEEvSY0z6CWpcQa9JDXu/wAI\nGzSyQbNx8QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x25a205b9cc0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "vals = np.random.normal(0, 0.5, 10000)\n",
    "\n",
    "plt.hist(vals, 50)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.0021422057356575478"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.percentile(vals, 50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.64070301059941248"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.percentile(vals, 90)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.41207346812009299"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.percentile(vals, 20)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Activity"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Experiment with different parameters when creating the test data. What effect does it have on the percentiles?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
